package com.sen.patterns.structural.decorator.ex2;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class Decorator implements Work {

	private Work work;

	private List othersWork = new ArrayList();

	public Decorator(Work work) {
		this.work = work;
		othersWork.add("挖坑");
		othersWork.add("钉木板");
	}

	public void insert() {
		newMethod();
	}

	public void newMethod() {
		otherMethod();
		work.insert();
	}

	public void otherMethod() {
		ListIterator listIterator = othersWork.listIterator();
		while (listIterator.hasNext()) {
			System.out.println(((String)(listIterator.next())) + " 正在进行");
		}
	}
}
